﻿using System;
using Thrift.Protocol;
using Thrift.Server;
using Thrift.Transport;
using ThriftContractTest1;
using ThriftServerTest1.Impl;

namespace ThriftServerTest1
{
    internal class Program
    {
        private static void Main(string[] args)
        {

            //TServerTransport transport = new TServerSocket(8800);
            //var processor = new UserService.Processor(new UserServiceImpl());
            //TServer server = new TThreadPoolServer(processor, transport);
            //server.Serve();

            //========================


            TServerTransport transport = new TServerSocket(8800);
            UserService.Processor processorUserService = new UserService.Processor(new UserServiceImpl());
            CalcService.Processor processorCalcService = new CalcService.Processor(new CalcServiceImpl());

            TMultiplexedProcessor processorMulti = new TMultiplexedProcessor();
            processorMulti.RegisterProcessor("userService", processorUserService);
            processorMulti.RegisterProcessor("calcService", processorCalcService);

            TServer server = new TThreadPoolServer(processorMulti, transport);

            server.Serve();//Listening

            Console.ReadKey();

        }
    }
}
